package com.alipay.demo.trade.model.hb;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.alipay.demo.trade.utils.Utils;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class ExceptionInfoAdapter implements JsonSerializer<List> {

    public JsonElement serialize(List exceptionInfos, java.lang.reflect.Type type,
            JsonSerializationContext jsonSerializationContext) {
        return Utils.isListEmpty(exceptionInfos) ? null : new JsonPrimitive(StringUtils.join(exceptionInfos, "|"));
    }
}
